package com.dzk.cp.c11x5.index.cs.by;

import java.util.List;

import com.dzk.cp.c11x5.index.zhx.cs.ZHXnCSIndex;
import com.dzk.cp.c11x5.pojo.R5;

public abstract class CsByxZHXnIndex extends CsByxIndex {
	
	protected CsByxZHXnIndex setParams(int code, int num, int unit, String xc) {
		super.setParams(code, num, unit, xc);
		return this;
	}

	@Override
	protected Integer getCS(List<? extends R5> r5s, String xc) {
		return ZHXnCSIndex.getCS(r5s, xc);
	}

	public static CsByxZHXnIndex getInstance(int code, int num, int unit, String xc) {
		int n = (xc.length() + 1) / 3;
		switch (n) {
		case 1:
			return new CsByxZHX1Index().setParams(code, num, unit, xc);
		case 2:
			return new CsByxZHX2Index().setParams(code, num, unit, xc);
		case 3:
			return new CsByxZHX3Index().setParams(code, num, unit, xc);
		case 4:
			return new CsByxZHX4Index().setParams(code, num, unit, xc);
		case 5:
			return new CsByxZHX5Index().setParams(code, num, unit, xc);
		default:
			return null;
		}
	}

}

class CsByxZHX1Index extends CsByxZHXnIndex {

	@Override
	protected int getZQ() {
		return 11;
	}
	
}

class CsByxZHX2Index extends CsByxZHXnIndex {

	@Override
	protected int getZQ() {
		return 110;
	}
	
}

class CsByxZHX3Index extends CsByxZHXnIndex {

	@Override
	protected int getZQ() {
		return 990;
	}
	
}

class CsByxZHX4Index extends CsByxZHXnIndex {

	@Override
	protected int getZQ() {
		return 11 * 10 * 9 * 8;
	}
	
}

class CsByxZHX5Index extends CsByxZHXnIndex {

	@Override
	protected int getZQ() {
		return 11 * 10 * 9 * 8 * 7;
	}
	
}
